package com.yy.tech.data.coder.secret.encrypt;

import com.yy.tech.data.coder.secret.std.Aes256Secret;
import com.yy.tech.data.coder.secret.std.Base64Secret;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author yy
 * @date 2022/4/4
 * @description: TODO
 */
public interface Encrypt {

    String encrypt(String source);

    @Component("Aes256Encrypt")
    class Aes256Encrypt implements Encrypt {
        @Autowired
        private Aes256Secret secret;
        @Override
        public String encrypt(final String source) {
            return secret.encrypt(source);
        }
    }
    @Component("Base64Encrypt")
    class Base64Encrypt implements Encrypt{

        @Autowired
        private Base64Secret secret;
        @Override
        public String encrypt(final String source) {
            return secret.encrypt(source);
        }
    }
}
